/**
 * @file
 * @author  michal.nezerka@gmail.com
 * @brief   Map Window Declaration
 */

#ifndef WWMAPWND_H
#define WWMAPWND_H

#include "geoutils.h"
#include "tileprovider.h"

namespace wildwood
{

class MapWnd : public wxWindow
{
public:
    MapWnd(wxWindow *parent);
    virtual ~MapWnd();
    void render(wxDC& dc);
    void onPaint(wxPaintEvent& event);
    void onErase(wxEraseEvent& event);
    void OnMouseWheel(wxMouseEvent& event);
    void OnMouseLeftDown(wxMouseEvent& event);
    void OnMouseLeftUp(wxMouseEvent& event);
    void OnMouseMotion(wxMouseEvent& event);
    void SetZoom(const int newZoom);
    unsigned int GetZoom() { return mCenter.mZoom; };
    void MoveCenter(const int deltaX, const int deltaY);

    GeoPos getGeoPos() { return mCenterGeo; };
    void setGeoPos(const GeoPos newGeoPos);

private:
    void OnTileProviderEvent(wxThreadEvent& event);

    static const unsigned int CROSS_SIZE = 20;
    static const unsigned int CROSS_WIDTH = 1;

    TilePos mCenter;
    GeoPos mCenterGeo;
    TileProvider *mTileProvider;
    //int mZoom;
    wxPoint mDragOrigin;
    bool mDragging;

    DECLARE_EVENT_TABLE()
};

} // namespace

#endif // WWMAPWND_H
